package com.example.myapplication;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class GravityActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_gravity);

        Bundle extras = getIntent().getExtras();
        if(extras==null){
            throw new IllegalArgumentException("参数无效");
        }
        String param1 = extras.getString("param1");

        TextView param = findViewById(R.id.param);

        param.setText(param1);

        findViewById(R.id.back).setOnClickListener(view->{

            Intent data = new Intent();
            data.putExtra("result","返回结果：是你爱吃的东西");
            setResult(Activity.RESULT_OK, data);
            finish();
        });
    }
}